const app = getApp()
import util from '../../../../utils/util'
import {
  VisitDetail
} from '../../../../config/api'

Page({

  /**
   * 页面的初始数据
   */
  data: {
    id: '',
    detail: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    console.log(options)
    this.setData({
      id: options.id
    })

    this.getDetail();
  },

  getDetail() {
    let that = this;
    util.apiRequest(VisitDetail, {
      vid: that.data.id
    }, null).then(r => {
      console.log('详情：', r)
      that.setData({
        detail:r.data.data
      })
    })
  },

  // 预览事件图片
  previewReplyImg: function (e) {
    console.log('预览处理图片e:', e)
    let that = this;
    var index = e.currentTarget.dataset.index;
    let imgs = this.data.detail.imgs

    wx.previewImage({
      //当前显示图片
      current: imgs[index],
      //所有图片
      urls: imgs
    })
  },

})